/**
  ******************************************************************************
  * @file   
  * @brief  
  ******************************************************************************
  * @note

 */

#ifndef __INTEGRATOR_DIFFERENTIATOR_H
#define __INTEGRATOR_DIFFERENTIATOR_H

/* Includes ------------------------------------------------------------------*/
#include "System_Config.h"
#include "math.h"
/* Definitions ---------------------------------------------------------*/

typedef struct{
	uint32_t last_time_us;
	uint32_t now_time_us;
	float now_dt;
	float Integral_value;
	float up_limit;
	float down_limit;
}integrator_op;

typedef struct{
	float step;
	float rate;
	float x1_last;
	float x2_last;
	float x1_now;
	float x2_now;
	float fhan;
}differentiator_op;
#define System_tick_division 480
#define System_tick_us 0.000001
/* Private variables ---------------------------------------------------------*/

/* Global variables ---------------------------------------------------------*/

/*Functions------------------------------------------------------------------*/
void systick_integrator(float input_value,integrator_op * int_op);
void systick_integrator_init(integrator_op * int_op,float uplimit,float downlimit);
void fhan(differentiator_op * diff_op ,float value);
void iteration_differentiator(differentiator_op * diff_op);
void differentiator_init(differentiator_op * diff_op,float rate_r,float step_h);
/* Exported function declarations --------------------------------------------*/

#endif
